package com.tfjybj.itoo.exam.provider.controller;

import com.dmsdbj.itoo.tool.business.ItooResult;
import com.tfjybj.itoo.exam.websocket.SendMessageController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.websocket.Session;

@Api(tags = {"websockt接口"})
@RequestMapping(value = "/websockt")
@RestController
public class WebsocktController {
    private Session session;
    /**
     * 根据sessionid给对应的客户端发消息
     * @param SessionId
     * @return
     * @author 程金鹏
     * @since 2.0.0 2019年3月21日17:01:45
     */
    @ApiOperation(value = "根据sessionid给对应的客户端发消息")
    @PostMapping(value = {"/sendMessage"})
    public ItooResult sendMessage(@RequestBody String SessionId) {
        if (SessionId == null){
            return ItooResult.build(ItooResult.FAIL,"消息发送失败！");
        }
        SendMessageController sendMessageController =new SendMessageController();
        sendMessageController.incoming( SessionId);


            return ItooResult.build(ItooResult.SUCCESS,"消息发送成功");


    }




}
